package com.sen.Midium;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

/**
 * Given a string s, find the longest palindromic substring in s.
 * You may assume that the maximum length of s is 1000.
 *
 * Example 1:
 *
 * Input: "babad"
 * Output: "bab"
 * Note: "aba" is also a valid answer.
 *
 *
 * Example 2:
 *
 * Input: "cbbd"
 * Output: "bb"
 * */
public class L005_Longest_Palindromic_SubstringTest {

    L005_Longest_Palindromic_Substring test = null;

    @Before
    public void setUp() throws Exception {
        test = new L005_Longest_Palindromic_Substring();
    }

    @After
    public void tearDown() throws Exception {
        test = null;
    }

    @Test
    public void testLongestPalindrome_dp_1() {
        String input = "babad";
        String output = "bab";
        assertEquals(output,test.longestPalindrome_dp(input));
    }

    @Test
    public void testLongestPalindrome_dp_2() {
        String input = "cbbd";
        String output = "bb";
        assertEquals(output,test.longestPalindrome_dp(input));
    }

    @Test
    public void testLongestPalindrome_centerExpand_1(){
        String input = "babad";
        String output = "bab";
        assertEquals(output,test.longestPalindrome_centerExpand(input));
    }
    @Test
    public void testLongestPalindrome_centerExpand_2(){
        String input = "cbbd";
        String output = "bb";
        assertEquals(output,test.longestPalindrome_centerExpand(input));
    }
}